<template>
  <div class="text-left padding-lr">
    <el-form ref="form" :model="form" label-width="130px">
      <el-form-item label="充值金额（RMB）：">
        <span>{{ form.bankStatementAmount }}</span>
      </el-form-item>
      <el-form-item label="充值图片：">
        <div class="demo-image__preview">
          <el-image
            style="width: 100px; height: 100px"
            :src="url"
            :preview-src-list="srcList"
          >
          </el-image>
        </div>
      </el-form-item>
      <el-form-item label="备注：">
        <span>{{ form.customerRemark }}</span>
      </el-form-item>
      <el-form-item label="增加新备注：">
        <el-input type="textarea" v-model="form.remark"></el-input>
      </el-form-item>
      <el-form-item> </el-form-item>
      <el-form-item>
        <el-button type="success" @click="auditFun(1)">审核通过</el-button>
        <el-button type="danger" @click="auditFun(-1)">审核不通过</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
//引入 ajax 工具
//翻译工具
import { ajax } from "@/store/yg/common/utils";
import { closeDialog } from "@/utils";

import * as constant from "@/store/yg/common/constant";

export default {
  data() {
    return {
      fileUrl: constant.FILE_SERVER,
      form: {},
      auditFunData: {
        id: "",
        statementStatus: "",
        remark: ""
      },
      url:
        "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg",
      srcList: [
        "https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
      ]
    };
  },
  mounted() {
    const dataRow = this.$store.state.edit.row;
    this.form = dataRow;
    this.url = this.fileUrl + dataRow.rechargePicture;
    this.srcList[0] = this.fileUrl + dataRow.rechargePicture;
    console.log("dataRow", dataRow);
  },
  methods: {
    async auditFun(status) {
      console.log("status", status);
      this.auditFunData.statementStatus = status;
      this.auditFunData.remark = this.form.remark;
      this.auditFunData.id = this.form.id;
      console.log("log", this.auditFunData);
      const { code, data, message } = await ajax(
        "saveStatement",
        this.auditFunData
      );
      if (code == 200) {
        this.$message.success("成功");
        closeDialog();
      } else if (code == 500) {
        this.$message.error("服务器发生异常：" + message);
      } else {
        this.$message.error("程序异常");
      }
    }
  }
};
</script>

<style scoped>
/deep/ .el-select,
.el-input-number,
.el-date-editor {
  width: 100%;
}

.el-form-item {
  text-align: center;
}
</style>
